package com.ethan.crm.util;

import javax.servlet.http.HttpServletRequest;

/**
 * 常量相关字符串
 */
public class UserContext {
    /**
     * session中存放员工信息的key
     */
    public static final String USER_IN_SESSION = "USER_IN_SESSION";
    public static final String PERMISSION_IN_SESSION = "PERMISSION_IN_SESSION";
    public static final String MENU_IN_SESSION = "MENU_IN_SESSION";

    //TODO 一个请求对应一个线程吗？每个线程的ThreadLocal对象都不一样吗
    private static ThreadLocal<HttpServletRequest> local = new ThreadLocal<>();

    public static void set(HttpServletRequest request){
        local.set(request);
    }

    public static HttpServletRequest get(){
        return local.get();
    }
}
